<?php
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
NavBar::begin([
    'brandLabel' => '后台管理',
    'brandUrl' => Yii::$app->homeUrl.'admin',
    'options' => [
        'class' => 'navbar-inverse navbar-fixed-top',
    ],
]);

echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-left'],
    'items' => [
        ['label' => '数据', 'url' => ['/admin/data']],
    ],
]);

echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-right'],
    'items' => [
            ['label' => '创建用户', 'url' => ['/admin/default/assign-user']],
            ['label' => '修改密码', 'url' => ['/admin/default/change-password']],
        Yii::$app->user->isGuest ? (
        ['label' => 'Login', 'url' => ['/admin/default/login']]
        ) : (
            '<li>'
            . Html::beginForm(['/admin/default/logout'], 'post')
            . Html::submitButton(
                'Logout (' . Yii::$app->user->identity->username . ')',
                ['class' => 'btn btn-link']
            )
            . Html::endForm()
            . '</li>'
        )
    ],
]);
NavBar::end();

